package com.luckberry.murder.service.impl;

import com.luckberry.murder.entity.good.Good;
import com.luckberry.murder.mapper.GoodMapper;
import com.luckberry.murder.service.GoodService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GoodServiceImpl implements GoodService {

    @Resource
    private GoodMapper mapper;

    @Override
    public List<Good> getGoods() {
        return mapper.getGoods();
    }

    @Override
    public List<Good> getGoodsByName(String name) {
        return mapper.getGoodsByName(name);
    }

    @Override
    public List<Good> getGoodsByType(String type) {
        return mapper.getGoodsByType(type);
    }

    @Override
    public Good getGood(int gid) {
        return mapper.getGood(gid);
    }

    @Override
    public boolean addGood(Good good) {
        return mapper.addGood(good) == 1;
    }

    @Override
    public boolean deleteGood(int gid) {
        return mapper.deleteGood(gid) == 1;
    }

    @Override
    public boolean editGood(Good good) {
        return mapper.editGood(good) == 1;
    }
}
